<%--
  Created by IntelliJ IDEA.
  User: 如烟
  Date: 2020/9/23
  Time: 12:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="description" content="Hotel Template">
    <meta name="keywords" content="Hotel, unica, creative, html">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>假日酒店</title>

    <!-- Google Font -->
    <link href="https://fonts.googleapis.com/css?family=Taviraj:300,400,500,600,700,800,900&display=swap"
          rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800&display=swap" rel="stylesheet">

    <!-- Css Styles -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/font-awesome.min.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/flaticon.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/linearicons.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/owl.carousel.min.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/jquery-ui.min.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/nice-select.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/magnific-popup.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/slicknav.min.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/userCSS/style.css" type="text/css">
</head>

<body>
<!-- Page Preloder -->
<div id="preloder">
    <div class="loader"></div>
</div>

<!-- Header Section Begin -->
<header class="header-section other-page">
    <div class="container-fluid">
        <div class="inner-header">
            <div class="logo">
                <a href="${pageContext.request.contextPath}/user/hotelInit"><img src="${pageContext.request.contextPath}/static/img/logo.png" alt=""></a>
            </div>
            <div class="top-widget">
                <div class="top-info address">
                    <img src="${pageContext.request.contextPath}/static/img/placeholder.png" alt="">
                    <span><a href="https://www.gaode.com/search?id=B001C7X368&city=510104&geoobj=103.270242%7C30.172919%7C105.552962%7C31.199055&query_type=IDQ&query=%E6%98%A5%E7%86%99%E8%B7%AF&zoom=9.35">成都市</a> </span>
                </div>
                <div class="top-info phone-num">
                    <img src="${pageContext.request.contextPath}/static/img/phone.png" alt="">
                    <span>028-82879625</span>
                </div>
            </div>
            <div class="container">
                <nav class="main-menu mobile-menu">
                    <ul>
                        <li><a href="${pageContext.request.contextPath}/user/index">主页</a></li>
                        <li><a href="${pageContext.request.contextPath}/user/aboutusInit">关于</a></li>
                        <li><a href="${pageContext.request.contextPath}/user/homeShowInit">房间</a>
                            <ul class="drop-menu">
                                <%--                                <c:forEach items="${allRoom}" var="allRoom"></c:forEach>--%>
                                <li><a href="${pageContext.request.contextPath}/user/eachRoomShow?type=总统套房">总统套房</a></li>
                                <li><a href="${pageContext.request.contextPath}/user/eachRoomShow?type=普通海景房">普通海景房</a></li>
                                <li><a href="${pageContext.request.contextPath}/user/eachRoomShow?type=单人间">单人间</a></li>
                                <li><a href="${pageContext.request.contextPath}/user/eachRoomShow?type=双人间">双人间</a></li>
                                <li><a href="${pageContext.request.contextPath}/user/eachRoomShow?type=三人间">三人间</a></li>
                            </ul>
                        </li>
                        <li><a href="${pageContext.request.contextPath}/user/serviceShowInit">服务</a></li>
                        <li><a href="${pageContext.request.contextPath}/user/newShowInit">公告</a></li>
                        <li><a href="${pageContext.request.contextPath}/user/contactInit">联系</a></li>
                    </ul>
                </nav>
            </div>
            <div id="mobile-menu-wrap"></div>
        </div>
    </div>
    <div>
        <span style="font-size: medium;color:rgb(174,149,72);margin-left: 320px ">
            <c:choose>
                <c:when test="${user.loginName!=null}">
                    尊敬的<a href='${pageContext.request.contextPath}/user/orderChk?userId="+ ${user.userId} +"'>${user.loginName}</a>您好
                </c:when>
                <c:otherwise>
                    尊敬的游客您好
                </c:otherwise>
            </c:choose>
        </span>
    </div>
</header>
<!-- Header End -->

<!-- Hero Section Begin -->
<section class="hero-section set-bg" data-setbg="${pageContext.request.contextPath}/static/img/rooms-bg.jpg">
    <div class="hero-text">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <h1>房型</h1>
                </div>
            </div>
            <div class="page-nav">
                <a href="${pageContext.request.contextPath}/user/aboutusInit" class="left-nav"><i class="lnr lnr-arrow-left"></i>关于</a>
                <a href="${pageContext.request.contextPath}/user/serviceShowInit" class="right-nav">服务<i class="lnr lnr-arrow-right"></i></a>
            </div>
        </div>
    </div>
</section>
<!-- Hero Section End -->
<input type="hidden" name="userId" id="userId" value="${user.userId}">

<!-- Rooms Section Begin -->
<section class="room-section spad">
    <form action="${pageContext.request.contextPath}/user/eachRoomShow" method="post" id="roomForm">
    <div class="container">
        <%--   循环数据库的房型 --%>
        <c:forEach items="${pageInfo.list}" var="room">
            <div class="rooms-page-item">
                <div class="row">
                    <div class="col-lg-6">
                        <input type="hidden" name="hId" id="hId" value="${room.hId}">
                        <input type="hidden" name="type" id="type" value="${type}">
                        <div class="room-pic-slider owl-carousel">
                            <div class="single-room-pic">
                                <img src="${room.hotelImg}" alt="">
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="room-text">
                            <div class="room-title">
                                <h2>${room.hotelType}</h2>
                                <div class="room-price">
                                    <span>price</span>
                                    <h2>¥${room.price}</h2>
                                    <sub>/晚</sub>
                                </div>
                            </div>
                            <div class="room-desc">
                                <p>${room.description}</p>
                            </div>
                            <div class="room-features">
                                <div class="room-info">
                                    <i class="flaticon-019-television"></i>
                                    <span>智能电视</span>
                                </div>
                                <div class="room-info">
                                    <i class="flaticon-029-wifi"></i>
                                    <span>Wi-Fi</span>
                                </div>
                                <div class="room-info">
                                    <i class="flaticon-003-air-conditioner"></i>
                                    <span>空调</span>
                                </div>
                                <div class="room-info">
                                    <i class="flaticon-036-parking"></i>
                                    <span>免费停车</span>
                                </div>
                                <div class="room-info last">
                                    <i class="flaticon-007-swimming-pool"></i>
                                    <span>室外泳池</span>
                                </div>
                            </div>
    
                            <c:choose>
                                <c:when test="${room.ifRenting ==0}">
                                    <c:choose>
                                        <c:when test="${user.loginId!=null}">
                                            <a href="${pageContext.request.contextPath}/user/roomOrder?hId=${room.hId}" class="primary-btn">立即预定<i class="lnr lnr-arrow-right"></i></a>
                                        </c:when>
                                        <c:otherwise>
                                            <span style="color: #fd7e14">请先登录账号!</span>
                                            <a href="${pageContext.request.contextPath}/user/loginInit">登录</a>
                                        </c:otherwise>
                                    </c:choose>
                                </c:when>
                                <c:otherwise>
                                    <a href="#" class="primary-btn">已满房<i class="lnr lnr-arrow-right"></i></a>
                                </c:otherwise>
                            </c:choose>
                        </div>
                    </div>
                </div>
            </div>
        </c:forEach>
        <%--   循环数据库的房间图片     --%>
        <span style="color:rgb(114,53,3);margin-left: 460px">${msg}</span>
    </div>
<%--        分页--%>
        <div class="col-md-6 offset-md-4">
            <nav aria-label="Page navigation example" style="margin-left: 180px">
                <ul class="pagination pagination-sm">
                    <li class="page-item"><a class="page-link"  onclick="fanye1()" href="javascript:void(0)">首页</a></li>
                    <c:if test="${pageInfo.hasPreviousPage}">
                        <li class="page-item"><a class="page-link" onclick="fanye2(page)" href="javascript:void(0)">上一页</a></li>
                    </c:if>
                    <c:if test="${pageInfo.hasNextPage}">
                        <li class="page-item"><a class="page-link" onclick="fanye3()" href="javascript:void(0)">下一页</a></li>
                    </c:if>
                    <li class="page-item"><a class="page-link" onclick="fanye4()" href="javascript:void(0)">末页</a>
                    </li>
                </ul>
            </nav>
        </div>
        <%--        分页--%>
    </form>
</section>
<!-- Rooms Section End -->

<!-- Footer Section Begin -->
<footer class="footer-section">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="footer-logo">
                    <a href="#"><img src="${pageContext.request.contextPath}/static/img/logo.png" alt=""></a>
                </div>
            </div>
        </div>
        <div class="row pb-50">
            <div class="col-lg-3 col-sm-6">
                <div class="single-footer-widget">
                    <h5>地址</h5>
                    <div class="widget-text">
                        <i class="lnr lnr-map-marker"></i>
                        <p>四川省, <br />成都市</p>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-sm-6">
                <div class="single-footer-widget">
                    <h5>前台</h5>
                    <div class="widget-text">
                        <i class="lnr lnr-phone-handset"></i>
                        <p>028-82879625</p>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-sm-6">
                <div class="single-footer-widget">
                    <h5>接车服务</h5>
                    <div class="widget-text">
                        <i class="lnr lnr-phone-handset"></i>
                        <p>028-82823625</p>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-sm-6">
                <div class="single-footer-widget">
                    <h5>餐厅</h5>
                    <div class="widget-text">
                        <i class="lnr lnr-phone-handset"></i>
                        <p>028-82823825</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="copyright-area">
        <div class="container">
            <div class="copyright-text"><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
                Copyright &copy;<script>document.write(new Date().getFullYear());</script>
                <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></div>
            <div class="privacy-links">
                <a href="#">隐私政策</a>
            </div>
        </div>
    </div>
</footer>
<!-- Footer Section End -->

<!-- Js Plugins -->
<script src="${pageContext.request.contextPath}/static/js/userJS/jquery-3.3.1.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/jquery.magnific-popup.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/jquery-ui.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/jquery.nice-select.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/jquery.slicknav.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/owl.carousel.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/userJS/main.js"></script>

<script>
        function fanye1() {
            var type = $("#type").val()
            location.href = "${pageContext.request.contextPath}/user/eachRoomShow?type="+type +'&page='+1
        }
        function fanye2() {
            var type = $("#type").val()
            location.href = "${pageContext.request.contextPath}/user/eachRoomShow?type="+type +'&page='+${pageInfo.pageNum-1}
        }
        function fanye3() {
            var type = $("#type").val()
            location.href = "${pageContext.request.contextPath}/user/eachRoomShow?type="+type +'&page='+${pageInfo.pageNum+1}
        }
        function fanye4() {
            var type = $("#type").val()
            location.href = "${pageContext.request.contextPath}/user/eachRoomShow?type="+type +'&page='+${pageInfo.pages}
        }
</script>

</body>

</html>
